<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
require 'appmanager/mysql_connect.php';
$vPage='login';
require 'appmanager/jtools.inc';

$vRefID		= strtoupper($_REQUEST["pRefID"]);
$vAgreed	= $_REQUEST["pAgreed"];
$vAction	= jdecrypt($_REQUEST["pAction"]);

$vQuery="SELECT idREAgent, RefID FROM reagent WHERE UCASE(RefID)='" . $vRefID . "'";
$rsIDs = mysql_query($vQuery) or die("Invalid query 1: " . mysql_error());
if ((mysql_num_rows($rsIDs) == 1) && ($vAction == 'login')) {
	$rsID = mysql_fetch_array($rsIDs, MYSQL_BOTH); 
	setcookie("RealtyAppCookie_RefID",$rsID["RefID"]);
	setcookie("RealtyAppCookie_AgentID",$rsID["idREAgent"]);
	$vRedirect = '<meta http-equiv="refresh" content="0;URL=appmanager/home.php">';
} elseif ($vAction == 'login') {
	$vMessage='Unkown Ref ID!';
}

if ($vAction == 'logout') setcookie ('RealtyAppCookie_RefID', '', time() - 3600);

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head><?=$vRedirect?>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>SIBOR</title>
        <link rel="shortcut icon" href="http://siborappmanager.com/favicon.ico" type="image/x-icon" />
        <link href="style.css" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="js/jquery.min.js"></script>

        <script type="text/javascript" src="js/jquery.validation.js"></script>
        <script type="text/javascript" src="js/jquery.printElement.js"></script>
        <script type="text/javascript" src="js/register.js"></script>
			<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
	<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript">
$(document).ready(function()
{
	$("#login").click(function (){
		if ($("#agree").is(':checked')) {	
		    $("#login_form").submit();	
		} else {	
			$("#error_msg").html("Please confirm you agree to our Terms & Conditions?");
		}
	});
	
	$('#login_form').submit(function(){
		if ($('#agree').is(':checked')) {
			$("#error_msg").html("");
			return true;
		} else {
			$("#error_msg").html("Please confirm you agree to our Terms & Conditions?");
			return false;
		}
	});
	
	$("#agree").click(function() {
		$("#agree_error").html("");
	});
	
	$(".addpopup").fancybox({
				'width'				: '501px',
				'height'			: '400px',
				'autoScale'			: false,
			    'transitionIn'		: 'fadein',
				'transitionOut'		: 'fadeout',
				
			});
	
});
</script>
    </head>
    <body>
        <div class="bottomcontent">
            <div class="full_wrap cc">
                <div class="bgcontent2 cc">
                    <div class="baner_side2">
                        <div class="cc">
						<a href="index.php" id="homebutton"><img src="images/homebtn.png" style="float:right;display:block;"></a>
						<a href="login.php#" class="logo2" id="logo" ><img src="images/logo.png"></a>
 <p class="titlelogo"><img src="images/title_logo.png"></p>

                           
                        </div>
                        <div class="signin_container">


		<div id="site_login_box" class="cc">
          
            <form id="login_form" class="form_simple" target="" action="login.php" method="POST">
                    <input type="hidden" name="pAction" value="<?=jencrypt('login')?>">

               <div class="cc"> <label for="id_username_login">Ref ID</label>
                <input type="text" maxlength="255" name="pRefID" id="ref_id">
				<div class="cc login-error" id="error_msg"></div>
			  </div>
                <br>
				<div class="rememberme">
                <input type="checkbox" id="agree" name="pAgreed" value="1" style="position:relative;top:9px;">
                <label for="id_agree" id="remember_me_label">I agree to <a class="addpopup" href="popup_data.php?link=term" style="color: #529700 !important;text-decoration:none;">terms</a> and <a class="addpopup" href="popup_data.php?link=privacy" style="color: #529700 !important;text-decoration:none;">privacy policy.</a></label>
                
                <p class="error_wrapper"><?=$vMessage?></p>
                </div>
                <input type="hidden" id="id_action_type" value="login" name="action_type">
                
                
             
              <p><a data-name="login_forgot_password" data-category="registration" href="javascript:void(0)" id="login">&nbsp;</a></p>
            </form>
        </div>
 </div>
 <div id="site_register_box">
    <div class="signup_button_box">
        <a id="starthere" href="index.php">&nbsp;</a>
    </div>

        <h2 style="margin:0;">Don't Have an Account?</h2>
<br/>
        <p>To use our interactive app management software you need to start here (to create your account).
        </p>

</div>
                        
                   
                </div></div> </div>
        </div>

        <div class="footer_wrap cc">
            <div class="lfooter">
                <p style="font-size: 11px;">Copyright and Powered by The Digital Planit Company</p>
            </div>
            <div class="rfooter"><img src="images/realtysmartapps_logo.png"></div>
        </div>
    </body>
</html>
